#!/bin/bash

BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
cd $BASE_DIR || exit;

shopt -s expand_aliases
[ "$(uname)" == "Darwin" ] &&  alias date='gdate'

ENV="dev"

start=2024-08-01
end='2025-05-01'
while ! [[ $start > $end ]]; do
    year_month=$(date -d  "${start}" +%Y%m)   #  yyyy-MM-dd  ==>  yyyymm
    day=$(date -d "$start" +%d)            #  yyyy-MM-dd   ==> dd
    echo "[`date`] executing  ${year_month}/${day}"
    rsync -azc     --include '*merrecord_V2.zip'    --exclude='*'   -e 'ssh -o "ProxyCommand ssh -A tunnel_user@188.208.58.4 ssh -p6050 -A tunnel_user@221.7.193.131 -W %h:%p"' /mnt/e/收银宝/gx/${year_month}/${day}/  tunnel_user@10.208.3.110:/opt/trx-data-importer/data/trx-data-files/gx/${year_month}/${day}/
    start=$(date -d "$start + 1 day" +%F)
done




